#pragma once
// MESSAGE DOWNLINK_PARAMS PACKING

#define MAVLINK_MSG_ID_DOWNLINK_PARAMS 202

MAVPACKED(
typedef struct __mavlink_downlink_params_t {
 float frequency; /*<  downlink frequency(MHz).*/
 float symbol_rate; /*<  downlink symbol rate.*/
 float polar_type; /*<  downlink polar polar_type.*/
 float res1; /*<  res1.*/
 float res2; /*<  res2.*/
 float res3; /*<  res3.*/
 uint8_t type; /*<  The params of beacon at dvb/beacon/radio mode.*/
}) mavlink_downlink_params_t;

#define MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN 25
#define MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN 25
#define MAVLINK_MSG_ID_202_LEN 25
#define MAVLINK_MSG_ID_202_MIN_LEN 25

#define MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC 163
#define MAVLINK_MSG_ID_202_CRC 163



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_DOWNLINK_PARAMS { \
    202, \
    "DOWNLINK_PARAMS", \
    7, \
    {  { "frequency", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_downlink_params_t, frequency) }, \
         { "symbol_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_downlink_params_t, symbol_rate) }, \
         { "polar_type", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_downlink_params_t, polar_type) }, \
         { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_downlink_params_t, type) }, \
         { "res1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_downlink_params_t, res1) }, \
         { "res2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_downlink_params_t, res2) }, \
         { "res3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_downlink_params_t, res3) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_DOWNLINK_PARAMS { \
    "DOWNLINK_PARAMS", \
    7, \
    {  { "frequency", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_downlink_params_t, frequency) }, \
         { "symbol_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_downlink_params_t, symbol_rate) }, \
         { "polar_type", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_downlink_params_t, polar_type) }, \
         { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_downlink_params_t, type) }, \
         { "res1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_downlink_params_t, res1) }, \
         { "res2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_downlink_params_t, res2) }, \
         { "res3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_downlink_params_t, res3) }, \
         } \
}
#endif

/**
 * @brief Pack a downlink_params message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param frequency  downlink frequency(MHz).
 * @param symbol_rate  downlink symbol rate.
 * @param polar_type  downlink polar polar_type.
 * @param type  The params of beacon at dvb/beacon/radio mode.
 * @param res1  res1.
 * @param res2  res2.
 * @param res3  res3.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_downlink_params_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               float frequency, float symbol_rate, float polar_type, uint8_t type, float res1, float res2, float res3)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN];
    _mav_put_float(buf, 0, frequency);
    _mav_put_float(buf, 4, symbol_rate);
    _mav_put_float(buf, 8, polar_type);
    _mav_put_float(buf, 12, res1);
    _mav_put_float(buf, 16, res2);
    _mav_put_float(buf, 20, res3);
    _mav_put_uint8_t(buf, 24, type);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN);
#else
    mavlink_downlink_params_t packet;
    packet.frequency = frequency;
    packet.symbol_rate = symbol_rate;
    packet.polar_type = polar_type;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.res3 = res3;
    packet.type = type;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_DOWNLINK_PARAMS;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
}

/**
 * @brief Pack a downlink_params message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param frequency  downlink frequency(MHz).
 * @param symbol_rate  downlink symbol rate.
 * @param polar_type  downlink polar polar_type.
 * @param type  The params of beacon at dvb/beacon/radio mode.
 * @param res1  res1.
 * @param res2  res2.
 * @param res3  res3.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_downlink_params_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   float frequency,float symbol_rate,float polar_type,uint8_t type,float res1,float res2,float res3)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN];
    _mav_put_float(buf, 0, frequency);
    _mav_put_float(buf, 4, symbol_rate);
    _mav_put_float(buf, 8, polar_type);
    _mav_put_float(buf, 12, res1);
    _mav_put_float(buf, 16, res2);
    _mav_put_float(buf, 20, res3);
    _mav_put_uint8_t(buf, 24, type);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN);
#else
    mavlink_downlink_params_t packet;
    packet.frequency = frequency;
    packet.symbol_rate = symbol_rate;
    packet.polar_type = polar_type;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.res3 = res3;
    packet.type = type;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_DOWNLINK_PARAMS;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
}

/**
 * @brief Encode a downlink_params struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param downlink_params C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_downlink_params_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_downlink_params_t* downlink_params)
{
    return mavlink_msg_downlink_params_pack(system_id, component_id, msg, downlink_params->frequency, downlink_params->symbol_rate, downlink_params->polar_type, downlink_params->type, downlink_params->res1, downlink_params->res2, downlink_params->res3);
}

/**
 * @brief Encode a downlink_params struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param downlink_params C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_downlink_params_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_downlink_params_t* downlink_params)
{
    return mavlink_msg_downlink_params_pack_chan(system_id, component_id, chan, msg, downlink_params->frequency, downlink_params->symbol_rate, downlink_params->polar_type, downlink_params->type, downlink_params->res1, downlink_params->res2, downlink_params->res3);
}

/**
 * @brief Send a downlink_params message
 * @param chan MAVLink channel to send the message
 *
 * @param frequency  downlink frequency(MHz).
 * @param symbol_rate  downlink symbol rate.
 * @param polar_type  downlink polar polar_type.
 * @param type  The params of beacon at dvb/beacon/radio mode.
 * @param res1  res1.
 * @param res2  res2.
 * @param res3  res3.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_downlink_params_send(mavlink_channel_t chan, float frequency, float symbol_rate, float polar_type, uint8_t type, float res1, float res2, float res3)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN];
    _mav_put_float(buf, 0, frequency);
    _mav_put_float(buf, 4, symbol_rate);
    _mav_put_float(buf, 8, polar_type);
    _mav_put_float(buf, 12, res1);
    _mav_put_float(buf, 16, res2);
    _mav_put_float(buf, 20, res3);
    _mav_put_uint8_t(buf, 24, type);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS, buf, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
#else
    mavlink_downlink_params_t packet;
    packet.frequency = frequency;
    packet.symbol_rate = symbol_rate;
    packet.polar_type = polar_type;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.res3 = res3;
    packet.type = type;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS, (const char *)&packet, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
#endif
}

/**
 * @brief Send a downlink_params message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_downlink_params_send_struct(mavlink_channel_t chan, const mavlink_downlink_params_t* downlink_params)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_downlink_params_send(chan, downlink_params->frequency, downlink_params->symbol_rate, downlink_params->polar_type, downlink_params->type, downlink_params->res1, downlink_params->res2, downlink_params->res3);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS, (const char *)downlink_params, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
#endif
}

#if MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_downlink_params_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  float frequency, float symbol_rate, float polar_type, uint8_t type, float res1, float res2, float res3)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_float(buf, 0, frequency);
    _mav_put_float(buf, 4, symbol_rate);
    _mav_put_float(buf, 8, polar_type);
    _mav_put_float(buf, 12, res1);
    _mav_put_float(buf, 16, res2);
    _mav_put_float(buf, 20, res3);
    _mav_put_uint8_t(buf, 24, type);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS, buf, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
#else
    mavlink_downlink_params_t *packet = (mavlink_downlink_params_t *)msgbuf;
    packet->frequency = frequency;
    packet->symbol_rate = symbol_rate;
    packet->polar_type = polar_type;
    packet->res1 = res1;
    packet->res2 = res2;
    packet->res3 = res3;
    packet->type = type;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DOWNLINK_PARAMS, (const char *)packet, MAVLINK_MSG_ID_DOWNLINK_PARAMS_MIN_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN, MAVLINK_MSG_ID_DOWNLINK_PARAMS_CRC);
#endif
}
#endif

#endif

// MESSAGE DOWNLINK_PARAMS UNPACKING


/**
 * @brief Get field frequency from downlink_params message
 *
 * @return  downlink frequency(MHz).
 */
static inline float mavlink_msg_downlink_params_get_frequency(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  0);
}

/**
 * @brief Get field symbol_rate from downlink_params message
 *
 * @return  downlink symbol rate.
 */
static inline float mavlink_msg_downlink_params_get_symbol_rate(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field polar_type from downlink_params message
 *
 * @return  downlink polar polar_type.
 */
static inline float mavlink_msg_downlink_params_get_polar_type(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field type from downlink_params message
 *
 * @return  The params of beacon at dvb/beacon/radio mode.
 */
static inline uint8_t mavlink_msg_downlink_params_get_type(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  24);
}

/**
 * @brief Get field res1 from downlink_params message
 *
 * @return  res1.
 */
static inline float mavlink_msg_downlink_params_get_res1(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field res2 from downlink_params message
 *
 * @return  res2.
 */
static inline float mavlink_msg_downlink_params_get_res2(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field res3 from downlink_params message
 *
 * @return  res3.
 */
static inline float mavlink_msg_downlink_params_get_res3(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Decode a downlink_params message into a struct
 *
 * @param msg The message to decode
 * @param downlink_params C-struct to decode the message contents into
 */
static inline void mavlink_msg_downlink_params_decode(const mavlink_message_t* msg, mavlink_downlink_params_t* downlink_params)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    downlink_params->frequency = mavlink_msg_downlink_params_get_frequency(msg);
    downlink_params->symbol_rate = mavlink_msg_downlink_params_get_symbol_rate(msg);
    downlink_params->polar_type = mavlink_msg_downlink_params_get_polar_type(msg);
    downlink_params->res1 = mavlink_msg_downlink_params_get_res1(msg);
    downlink_params->res2 = mavlink_msg_downlink_params_get_res2(msg);
    downlink_params->res3 = mavlink_msg_downlink_params_get_res3(msg);
    downlink_params->type = mavlink_msg_downlink_params_get_type(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN? msg->len : MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN;
        memset(downlink_params, 0, MAVLINK_MSG_ID_DOWNLINK_PARAMS_LEN);
    memcpy(downlink_params, _MAV_PAYLOAD(msg), len);
#endif
}
